package VN.EDU.IMIC.DEVELOPER.LETRONGKHANH.QLST;

import java.awt.Container;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

class SimpleSplashScreen extends JFrame {
	int delay = 2000; // default delay time 2 seconds

	SimpleSplashScreen(String imgfile) {
		ImageIcon iicon = new ImageIcon(imgfile);
		int iwidth = iicon.getIconWidth();
		int iheight = iicon.getIconHeight();
		setSize(iwidth, iheight);
		setLocationRelativeTo(null);
		setUndecorated(true);
		Container cont = getContentPane();
		JLabel lbl = new JLabel();
		lbl.setIcon(iicon);
		cont.add(lbl);
	}

	// set time delay
	public void wait(int mills) {
		delay = mills;
	}

	public void showScreen() {
		setVisible(true); // show the screen
		try {
			Thread.sleep(delay); // delay the screen
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// close the SplashScreen when time out
		dispose();

	}
}
